#include "DashboardUI_ViewRecords.h"
#include "ui_dashboard_viewrecords.h"

#include "Authentication.h"

DashboardUI_ViewRecords::DashboardUI_ViewRecords(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::DashboardUI_ViewRecords)
{
    ui->setupUi(this);

    User *user = Authentication::getInstance()->getUser();

    if (user->getUserType() == User::PATIENT)
    {
        recordDB.loadRecords(user->getId());
        ui->tableView->setModel(recordDB.getModel());
    }
}

DashboardUI_ViewRecords::~DashboardUI_ViewRecords()
{
    delete ui;
}
